package com.lwl.controller.sds;

import com.github.pagehelper.PageInfo;
import com.lwl.entity.LayData;
import com.lwl.entity.MyPage;
import com.lwl.entity.sds.TSdsCallback;
import com.lwl.service.sds.TSdsCallbackService;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpSession;

/**
 * (TSdsCallback)表控制层
 *
 * @author Lei
 * @since 2022-11-10 12:31:59
 */
@RestController
@RequestMapping("tSdsCallback")
public class TSdsCallbackController {
    /**
     * 服务对象
     */
    @Autowired
    private TSdsCallbackService tSdsCallbackService;


    /**
     *  查询所有的回访记录
     * @return
     */
    @GetMapping("queryAll")
    public LayData queryAll(MyPage myPage, TSdsCallback tSdsCallback){
        PageInfo pageInfo = tSdsCallbackService.queryAll(myPage,tSdsCallback);
        return new LayData(pageInfo);
    }


    /**
     * 添加/修改回访记录
     * 添加/修改回访记录时要验证回访用户的id以及对应测试计划的id是否正确。
     * @return
     */
    @PostMapping("updateCallback")
    public LayData updateCallback(TSdsCallback tSdsCallback, HttpSession session){
        int insert = tSdsCallbackService.insertCallback(tSdsCallback,session);
        return new LayData(insert);
    }



}
